#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
#include<string.h>
bool isPalindrome(char s[2])
{
    int left = 0;
    int right = 1;
    // char start = s[head];
    // char end = s[tail];
    //tail--;
    while (left < right)
    {
        if (s[left]<=64||s[left]>=123||91<=s[left]&&s[left]<=96)
        {
            left++;
        }
        else if (65 <= s[left] && s[left] <= 90)
        {
            s[left] +=  ' ';
        }
        else if (s[right] <= 64 || s[right] >= 123 || 91 <= s[right] && s[right] <= 96)
        {
            right--;
        }
        else if (65 <= s[right] && s[right] <= 90)
        {
            s[right] += ' ';
        }
        else if (s[left] != s[right])
        {
            return false;
        }
        else
        {
            left++;
            right--;
        }

    }
    return true;
}
bool judge(char str) {
    if ((str >= 'A' && str <= 'Z') || (str >= 'a' && str <= 'z') || (str >= '0' && str <= '9')) {
        return true;
    }
    else {
        return false;
    }
}
bool isPalindrome2(char* s) {
    int left, right;
    left = 0, right = strlen(s) - 1;
    while (left < right) {
        if (judge(s[left]) && judge(s[right])) {
            if (s[left] <= 'Z' && s[left] >= 'A') {
                s[left] = s[left] + 'a' - 'A';
            }
            if (s[right] <= 'Z' && s[right] >= 'A') {
                s[right] = s[right] + 'a' - 'A';
            }
            if (s[left] != s[right]) {
                return false;
            }
            left++;
            right--;
        }
        else if (!judge(s[left])) {
            left++;
        }
        else {
            right--;
        }
    }
    return true;
}
int main()
{
    char s[2] = "0P";
    int i = isPalindrome(s);
    return 0;
}
bool isPalindrome1(char* s)
{
    int left = 0;
    int right = strlen(s) - 1;
    // char start = s[head];
    // char end = s[tail];
    //tail--;
    while (left < right)
    {
        if (s[left] <= 47 || s[left] >= 58 && s[left] <= 64 || s[left] >= 123 || 91 <= s[left] && s[left] <= 96)
        {
            left++;
        }
        else if (65 <= s[left] && s[left] <= 90)
        {
            s[left] += 32;
        }
        else if (s[right] <= 47 || s[right] >= 58 && s[right] <= 64 || s[right] >= 123 || 91 <= s[right] && s[right] <= 96)
        {
            right--;
        }
        else if (65 <= s[right] && s[right] <= 90)
        {
            s[right] += 32;
        }
        else if (s[left] != s[right])
        {
            return false;
        }
        else
        {
            left++;
            right--;
        }

    }
    return true;
}
